<?php
include "../proses/konek.php";
session_start();
if(!isset($_SESSION['username']))
   {   
   ?><script language="javascript">alert('anda blm login');
document.location='../'</script><?php
 }
else
{
$username = $_SESSION['username'];
$status = $_SESSION['status'];
$simpan2=mysql_query("SELECT * FROM  $status where email = '$username'");
$hasil2=mysql_fetch_array($simpan2);
}

if(!isset($_GET['id']))
   {   
   ?><script language="javascript">alert('DATA TIDAK DITEMUKAN');
document.location='../page/listpost.php'</script><?php
 }
else
{
$id = $_GET['id'];
}
$sql=mysql_query("select * from posting where idpost='$id'");
$cek=mysql_fetch_assoc($sql);
?>
<html>
<head>
    <meta content="IE=edge" http-equiv="X-UA-Compatible"></meta>

<meta content="width=device-width, initial-scale=1" name="viewport"></meta>

<meta content="" name="description"></meta>

	<link rel='stylesheet' href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700"  />
	<script type="text/javascript" src="../plugin/tinymce/tinymce.min.js"></script>
	<!-- The main CSS file -->
	<link rel="stylesheet" type="text/css" href="../css/sidebar.css">
    <link rel="stylesheet" href="../css/bootstrap/css/bootstrap.css" >
	<link rel="stylesheet" href="../css/bootstrap/css/bootstrap.min.css" >
	<link rel="stylesheet" type="text/css" href="../css/bootstrap/css/bootstrap-theme.min.css">
	<title>Edit Menu</title>
	<?php	
	require_once('../render.php');
	$render=new render;
	$render->navigasi();
	$render->icon();
	
	$render->profile($status, $username);
	
?>
</head>
<body style="margin-top:50px;">

<div id="wrapper">
	<div id="sidebar-wrapper">
		<?php
		include ('menuslide.php');
		$menu=new menu;
		$menu->init($username, $status);
		?>
	</div>
	<div id="page-content-wrapper">
		<div class="container-fluid">
			<div class="row" style="margin-top:80px">
				<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="subcontent">
					<!-- tinymce editor plugin -->
				
					<script>
					tinymce.init({
					    selector: "textarea#editor",
					    theme: "modern",
					    width: 700,
					    height: 300,
					    plugins: [
					         "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
					         "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
					         "save table contextmenu directionality emoticons template paste textcolor responsivefilemanager"
					   ],
					   content_css: "css/content.css",
					   toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons responsivefilemanager", 
					   style_formats: [
					        {title: 'Bold text', inline: 'b'},
					        {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
					        {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
					        {title: 'Example 1', inline: 'span', classes: 'example1'},
					        {title: 'Example 2', inline: 'span', classes: 'example2'},
					        {title: 'Table styles'},
					        {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
					    ],
					    external_filemanager_path:"/elearning/plugin/filemanager/",
					   filemanager_title:"Responsive Filemanager" ,
					   external_plugins: { "filemanager" : "/elearning/plugin/filemanager/plugin.min.js"}

					 });

					</script>
					<h3>POSTING</h3>
				
				<div class="">
				
				
					<form class="form-horizontal"  action="../proses/updateposting.php?id=<?php echo $cek['idpost'] ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
						<div class="form-group">
							<label class="col-sm-2 control-label">Judul Posting</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" name="judul" placeholder="Judul Postingan" value="<?php echo $cek['judul']?>" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Pelajaran</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" name="mapel" placeholder="Kategori Mata Pelajaran" value="<?php echo $cek['kategori']?>">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Kelas</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" name="kls" placeholder="Target tingkatan atau Kelas" value="<?php echo $cek['kelas']?>">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Isi Postingan</label>
							<div class="col-sm-10">
								<textarea id="editor" name="area"><?php echo $cek['isi']?></textarea>
							</div>
						</div>
	
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<button class="btn btn-primary" type="submit" name="save" id="save">Publish</button>
							</div>
						</div>
						</form>
						 
				</div>
						</div>
				</div>
				
			</div>
			 
</div>
<?php
$render->footer();

?>
<!-- JQuery Core -->
<script src="../js/search.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../css/bootstrap/js/bootstrap.js"></script>
<!-- Custom Sidebar Javascript--> 
<script type="text/javascript" src="../js/sidebar.js"></script>
<!-- Custom Javascript Load Page-->
<script src="../css/js/jquery.min.js"></script>
<script type="text/javascript" src="../js/metisMenu.min.js"></script>
<script src="../js/sb-admin-2.js"></script>	

<script type="text/javascript" src="../js/sidebar.js"></script>


		
</body>
</html>

	
